package com.eveinfo.api.character.sheet;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import com.eveinfo.api.AbstractApiParser;
import com.eveinfo.api.ApiAuth;
import com.eveinfo.api.ApiException;
import com.eveinfo.api.NoCacheFoundExecption;

public class SheetParser extends AbstractApiParser<ApiSheet, CharacterSheetHandler> {
	protected static final String CHARACTER_SHEET_URL = Path.CHARACTER.getPath() + "/CharacterSheet.xml.aspx";

	private static SheetParser instance;
	
	public static SheetParser getInstance(){
		if(instance == null){
			instance = new SheetParser();
		}
		return instance;
	}
	
	private SheetParser() {
		super(ApiSheet.class, 1, CHARACTER_SHEET_URL);
	}

	public ApiSheet getCharacterSheet(ApiAuth auth) throws IOException, SAXException, ParserConfigurationException,
			ApiException, NoCacheFoundExecption {
		CharacterSheetHandler handler = new CharacterSheetHandler();
		return getResponse(auth, handler);
	}

	public static boolean isInstancier() {
		return instance != null;
	}

}